package io.renren.common.filter;

import io.buji.pac4j.context.ShiroSessionStore;
import io.buji.pac4j.filter.SecurityFilter;
import org.pac4j.core.context.J2EContext;
import org.pac4j.core.context.session.SessionStore;
import org.pac4j.core.http.adapter.J2ENopHttpActionAdapter;
import org.pac4j.core.util.CommonHelper;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author cmy
 * @title: LocalSecurityFilter
 * @projectName my-security
 * @description: TODO
 * @date 2019/12/416:21
 */
public class LocalSecurityFilter extends SecurityFilter {


    /*public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        CommonHelper.assertNotNull("securityLogic", this.securityLogic);
        CommonHelper.assertNotNull("config", this.config);
        HttpServletRequest request = (HttpServletRequest)servletRequest;
        HttpServletResponse response = (HttpServletResponse)servletResponse;
        SessionStore<J2EContext> sessionStore = this.config.getSessionStore();
        J2EContext context = new J2EContext(request, response, (SessionStore)(sessionStore != null ? sessionStore : ShiroSessionStore.INSTANCE));
        this.securityLogic.perform(context, this.config, (ctx, profiles, parameters) -> {
            filterChain.doFilter(request, response);
            return null;
        }, J2ENopHttpActionAdapter.INSTANCE, this.clients, this.authorizers, this.matchers, this.multiProfile, new Object[0]);
    }*/

}
